//
//  ViewController.m
//  动画组
//
//  Created by hyl on 16/7/7.
//  Copyright © 2016年 hyl. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIView *redView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    CAAnimationGroup *animGroups=[CAAnimationGroup animation];
    CABasicAnimation *basic=[CABasicAnimation animation];
    CABasicAnimation *basic2=[CABasicAnimation animation];
    
    //removedOnCompletion无效果
    basic.keyPath=@"position";
    basic.toValue=[NSValue valueWithCGPoint:CGPointMake(150, 400)];
//    basic.removedOnCompletion=NO;
//    basic.fillMode=kCAFillModeForwards;
    //
    basic2.keyPath=@"transform.scale";
    basic2.toValue=@0.5;
//    basic2.removedOnCompletion=NO;
//    basic2.fillMode=kCAFillModeForwards;
    
    animGroups.animations=@[basic,basic2];
    animGroups.removedOnCompletion=NO;
    animGroups.fillMode=kCAFillModeForwards;
    [self.redView.layer addAnimation:animGroups forKey:nil];
}
@end
